IsIntoACivil=false;

if(!alive player)then{
	
	_finalPosPlayer=(getPos player);
	_finalDirPlayer=(getDir player);

	_camera = "camera" camCreate [0,0,200];

	_camera camSetPos [(_finalPosPlayer select 0)+10,(_finalPosPlayer select 1)+10,(_finalPosPlayer select 2)+10];
	_camera camSetTarget [(_finalPosPlayer select 0),(_finalPosPlayer select 1),(_finalPosPlayer select 2)+1.5];

	_camera camSetFov 0.700;
	_camera cameraEffect ["internal","back"];
	_camera camCommit 0;

	waitUntil { camCommitted _camera };

	sleep 10;
	
	player cameraEffect["terminate","back"];
	camDestroy _camera;
};

// hide the agent screen to force him to show the map
cutText ["Your are dead please wait...","BLACK",0.01];

waitUntil{ alive player };

player addMagazine "100Rnd_556x45_BetaCMag";
player addMagazine "100Rnd_556x45_BetaCMag";
player addMagazine "100Rnd_556x45_BetaCMag";

player addWeapon "G36A";
sleep 0.5;
player selectWeapon "G36A";

//HideWeaponFlag=false;
//player addAction ["Hide my weapons","HumanActionHideWeapon.sqf", [], 100, false, false, "", "true"];

onMapSingleClick "[_pos,_units] ExecVM 'AgentMapRespawn.sqf'; true;";

while{!IsIntoACivil}do{
	

	cutText ["Open your map to start !","BLACK",0.01];

	
	// wait for the player to open the map
	
	waitUntil{ visibleMap };
	

	// fade out the black sreen
	cutText ["","BLACK IN",1];
	
	waitUntil{ !visibleMap };
	
};